The SetExpand method sets a named value in the registry as a REG_EXPAND_SZ data type. If the key portion of the specified named value does not already exist, the SetExpand method adds that key and any specified subkeys to the registry.
SetExpand FullKeyValueName, Value [,Flush]
HKLM\Software\MyCompany\MyValue
The key portion of this parameter can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:
\\RemoteMachine\HKLM\Software\MyProg
If Flush is set to TRUE, the method immediately writes the registry changes to the disk. Note that explicitly flushing registry changes to the disk may reduce server performance.
If Flush is FALSE, the method does not immediately write the registry changes to the disk. They are instead written to disk by the registry's lazy flusher or when the system shuts down.
The default is FALSE.
The following example sets the named value MyPath
of the key
HKLM\Software\MyCompany
. Notice that the string data contains embedded environment variables, %windir% and %SystemRoot%.<% Set Reg = Server.CreateObject("IISSample.Registry") MyPath = "HKLM\Software\MyCompany\MyPath" Reg.SetExpand MyPath, "%windir%;%SystemRoot%\System32", True Path = Reg.Get(MyPath) PathExpand = Reg.GetExpand(MyPath) %> Path = <%= Path %> <br> PathExpand = <%= PathExpand %> <br>
Path = %windir%;%SystemRoot%\System32 PathExpand = D:\WINNT;D:\WINNT\System32